package com.gufe.controller.user.mp.quiz;

import com.gufe.entity.quiz.AnswerOption;
import com.gufe.mapper.user.mp.quiz.AnswerOptionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/answer-options")
public class AnswerOptionController {

    @Autowired
    private AnswerOptionMapper answerOptionMapper;

    @GetMapping("/question/{questionId}")
    public List<AnswerOption> getAnswerOptionsByQuestionId(@PathVariable Long questionId) {
        return answerOptionMapper.findByQuestionId(questionId);
    }

    @GetMapping("/{id}")
    public AnswerOption getAnswerOptionById(@PathVariable Long id) {
        return answerOptionMapper.findById(id);
    }

}